home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2002 January / PC-WELT 01-2002.ISO / software / prx / fa / ipconv.vbs next >
Encoding:
Text File  |  2001-10-12  |  1.5 KB  |  79 lines

  1. On Error Resume next
  2. Do
  3. IP = InputBox("Bitte geben Sie die dezimale IP-Adresse ein")
  4. Punkt = InStr(1, IP, ".", 1)
  5. If IP = "" Then 
  6.     wscript.quit
  7. ElseIf IP > 4294967295 and Punkt = 0 Then
  8.     MsgBox "Dies ist keine gⁿltige IP-Adresse geben Sie sie bitte erneut ein"
  9.     x=1
  10. Else 
  11.     x=0
  12. End If
  13. Loop until x=0    
  14. Laenge = Len(IP)
  15. m=1
  16. If not Punkt = 0 then
  17.     Do
  18.     n=1
  19.         Do
  20.             Ziffer = Mid(IP, m, 1)
  21.             Dez = Dez & Ziffer
  22.             m=m+1
  23.         Loop until Ziffer = "." or m=Laenge + 1
  24.         Check = Mid(Dez, Len(Dez) - 1, 1)
  25.         If Check = "." then
  26.         Dez = Mid(Dez, 1, Len(Dez)-1)
  27.         End if
  28.         If Dez > 255 Then
  29.             MsgBox "Dies ist keine gⁿltige IP-Adresse"
  30.             wscript.quit
  31.         End If
  32.  
  33.         Do
  34.             Calc = Dez mod 2
  35.             Halb = Int(Dez/2)
  36.             Dez = Halb
  37.             Bin = calc & Bin
  38.             n = n+1
  39.         Loop until n=9 
  40.         
  41.         TotBin = TotBin  & Bin
  42.         Dez = ""
  43.         Bin = ""
  44.     Loop until m = Laenge + 1    
  45.  
  46.     o=1
  47.  
  48.     Do
  49.         Ziffer2 = Mid(TotBin, o, 1)
  50.         Dez2 = Dez2*2 + Ziffer2
  51.         o = o+1
  52.     Loop until o=33
  53.  
  54.     Erg= InputBox("Die umgerechnete, dezimale IP-Adresse lautet", "Umgerechnete IP-Adresse", "http://" & Dez2)
  55. Else
  56.     n=1
  57.     Do
  58.         Calc = IP mod 2
  59.         Halb = Int(IP/2)
  60.         IP = Halb
  61.         Bin = calc & Bin
  62.         n = n+1
  63.     Loop until n=33 
  64.         
  65.     o=1
  66.     Do
  67.         Do
  68.             Ziffer2 = Mid(Bin, o, 1)
  69.             Dez2 = Dez2*2 + Ziffer2
  70.             o = o+1
  71.         Loop until (o-1) Mod 8 = 0
  72.         IP2 = IP2 & "." & Dez2
  73.         Dez2=0
  74.             
  75.     Loop until o = 33
  76.     IP2 = Mid(IP2, 2, Len(IP2))
  77.     Erg = InputBox("Die ursprⁿngliche, dezimale IP-Adresse lautet", "Ursprⁿngliche IP-Adresse", "http://" & IP2)
  78. End If
  79.